
def cache(f):
    memory = {}

    def wrapped(*args, **kwargs):
        key = f"{args}, {kwargs}"
        if key not in memory:
            print(f"new key: {key}")
            memory[key] = f(*args, **kwargs)
        return memory[key]
    return wrapped


@cache
def add(a, b):
    return a + b


print(add(1, 2))
print(add(2, 3))
print(add(1, 2))
